﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Users.aspx.cs" Inherits="DentScan2.WebApp.Users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:MultiView runat="server" ID="mvUsers" ActiveViewIndex="0">
        <asp:View runat="server" ID="vUsers">
            <asp:Button runat="server" ID="bNew" Text="Нов потребител" OnClick="bNew_Click" />
            <asp:Repeater runat="server" ID="rUsers" OnItemCommand="rUsers_ItemCommand">
                <HeaderTemplate>
                    <table border="1" width="100%">
                        <tr>
                            <td>
                                <p class="bold">
                                    Потребителско име
                                </p>
                            </td>
                            <td>
                                <p class="bold">
                                    Име
                                </p>
                            </td>
                            <td>
                                <p class="bold">
                                    Ниво
                                </p>
                            </td>
                            <td>
                                <p class="bold">
                                    Активен
                                </p>
                            </td>
                            
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <asp:LinkButton runat="server" ID="lbEdit" CommandArgument='<%#Eval("UserId")%>'
                                CommandName="EDIT" Text='<%#Eval("UserName")%>' />
                            <br />
                            <asp:LinkButton runat="server" ID="lbPassChange" CommandArgument='<%#Eval("UserId")%>'
                                CommandName="PASS" Text="Смяна на парола" OnClientClick="return confirm('Моля, потвърдете!');" />
                        </td>
                        <td>
                            <%#Eval("FullName")%>
                        </td>
                        <td>
                            <%#Eval("Level.LevelName")%>
                        </td>
                        <td>
                            <asp:LinkButton runat="server" ID="lbDeactivate" CommandArgument='<%#Eval("UserId")%>'
                                CommandName="DEACTIVATE" Text='<%#Eval("IsDel").ToString()==false.ToString()?"Да":"Не" %>'
                                OnClientClick="return confirm('Моля, потвърдете!');" />
                        </td>                        
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </asp:View>
        <asp:View runat="server" ID="vEdit">
            <asp:ValidationSummary ID="vsInvoice" runat="server" ValidationGroup="vgUser" CssClass="failureNotification" />
            <table>
                <tr>
                    <td>
                        <p class="bold">
                            Потребителско име
                        </p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbUserName" />
                        <asp:RequiredFieldValidator runat="server" ID="rfvUserName" ErrorMessage="Моля, въведете потребителско име"
                            ValidationGroup="vgUser" Display="None" ControlToValidate="tbUserName" />
                        <asp:CustomValidator runat="server" ID="cvUserName" ErrorMessage="Моля, въведете уникално потреблитеско име"
                            ValidationGroup="vgUser" Display="None" ControlToValidate="tbUserName" OnServerValidate="cvUserName_ServerValidate" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="bold">
                            Име
                        </p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbFullName" />
                        <asp:RequiredFieldValidator runat="server" ID="rfvFullName" ErrorMessage="Моля, въведете име"
                            ValidationGroup="vgUser" Display="None" ControlToValidate="tbFullName" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="bold">
                            Ниво
                        </p>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlLevel"/>                            
                    </td>
                </tr>
                
                <tr>
                    <td>
                        <asp:Button runat="server" ID="bSave" Text="Запис" OnClick="bSave_Click" />
                    </td>
                    <td>
                        <asp:Button runat="server" ID="bCancel" Text="Отказ" OnClick="bCancel_Click" />
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>
